const mongoose = require("mongoose")
/**
 * 用户关系(联系人)
 */
module.exports = mongoose.model(
	'Relationship',
	new mongoose.Schema({
		user: {
			type: mongoose.Schema.Types.ObjectId,
			ref: 'User'
		},
		visitor: {
			type: mongoose.Schema.Types.ObjectId,
			ref: 'User'
		},
		remarks: String,
		created: {
			type: Date,
			default: Date.now(),
			get: function (val) {
				return new Date(val).toLocaleString()
			}
		},
		updated: {
			type: Date,
			default: Date.now(),
			get: function (val) {
				return new Date(val).toLocaleString()
			}
		}
	}, { toJSON: { getters: true } })
);